<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <template id="t1">
      <div>
        <h1>hello</h1>
        {{count}} <button @click="count++">+</button>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      const vm = new Vue({
        el: "#app",
        template: "#t1",
        data: {
          count: 1,
        },
        beforeCreate() {
          console.log(1, "beforeCreate");
        },
        created() {
          console.log(2, "created", document.querySelector("h1"));
        },
        beforeMount() {
          console.log(3, "beforeMount");
        },
        mounted() {
          console.log(4, "mounted", document.querySelector("h1"));
        },
        beforeDestroy() {
          console.log(5, "beforeDestroy");
        },
        destroyed() {
          console.log(6, "destroyed");
        },

        beforeUpdate() {
          console.log("beforeUpdate");
        },
        updated() {
          console.log("updated");
        },
      });

      setTimeout(() => {
        // vm.$destroy();
      }, 3000);
    </script>
  </body>
</html>
